{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0.016      0.02222449 0.02844898 0.03467347 0.04089796 0.04712245\n",
      " 0.05334694 0.05957143 0.06579592 0.07202041 0.0782449  0.08446939\n",
      " 0.09069388 0.09691837 0.10314286 0.10936735 0.11559184 0.12181633\n",
      " 0.12804082 0.13426531 0.1404898  0.14671429 0.15293878 0.15916327\n",
      " 0.16538776 0.17161224 0.17783673 0.18406122 0.19028571 0.1965102\n",
      " 0.20273469 0.20895918 0.21518367 0.22140816 0.22763265 0.23385714\n",
      " 0.24008163 0.24630612 0.25253061 0.2587551  0.26497959 0.27120408\n",
      " 0.27742857 0.28365306 0.28987755 0.29610204 0.30232653 0.30855102\n",
      " 0.31477551 0.321     ]\n",
      "------------------------------\n",
      "[6.984386958016879, 7.497471393556732, 7.855229648829523, 8.034811807885099, 8.026018380289848, 7.832455098617109, 7.4710739606042145, 6.970191104165917, 6.3663039223025475, 5.7001927634651475, 5.012861101287282, 4.3418388841619615, 3.718263811416211, 3.1649950610386304, 2.6958388859827918, 2.3158074237452158, 2.0222136422008496, 1.8063373302034456, 1.6553789112303785, 1.554440631318613, 1.4883248002776668, 1.4430019867137391, 1.406666402961255, 1.3703531359411274, 1.3281385524980756, 1.2769805643915622, 1.2162805635709333, 1.147264838888866, 1.0722902517879123, 0.9941758867678118, 0.9156480987622174, 0.8389608249740529, 0.7657185672389115, 0.6968911975648021, 0.6329747921772477, 0.5742283721215038, 0.5209081031990307, 0.4734299061310983, 0.43241595474760786, 0.39861394313077136, 0.37271209193745386, 0.35509968835854994, 0.3456367396931301, 0.3434946570803294, 0.3471139670300916, 0.3542990792736611, 0.36244020162784923, 0.3688251796395373, 0.3709851170458777, 0.36701091467179553]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWoAAAD4CAYAAADFAawfAAAAOXRFWHRTb2Z0d2FyZ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aVK1eipKQE3t7euO666zB06FAMHToU1157Le/656RY1EQupqysDBs2bMDy5cuxcuVKbNmyBaqK4OBgDBw4EEOHDkV0dDS6devGG0g5CRY1kYs7duwYVq1aha+++gorV67Enj17AACXXXYZBgwYgIEDB+LGG29EZGQkR9wWxaImcjPff/891qxZgzVr1mDt2rW1xR0UFITrrruudurbty/PKLEIFjWRmzt48CDWrVuHNWvWYP369cjPz8fZP/tdu3atLe2oqCh0796djyUzAYuaiM5z8uRJZGZmIj09HRkZGcjIyEBRUREAwNvbGxEREejduzd69eqFXr16ISIiAgEBASandm0saiK6JFXFd999h+zsbGzevBmbN29GdnY2fvrpp9p5OnTogIiICHTv3h3du3dHREQEOnXqBH9/fxOTuw4WNRHVm6pi//792Lx5M/Ly8pCfn4+8vDwUFBSgoqKidr42bdrgyiuvxBVXXIErr7wSV155JcLDwxEWFoZWrVrB09PTxLVwHixqIrKb8vJy7Nq1C3l5edi1axd2795dOx05cuS8eT09PdG6dWu0bdsWYWFhaN26NS6//PLa6bLLLqv9GhAQAH9/f/j7+9vlzBRVRWlpKUpLS3HmzJna6ZdffsEvv/xS+/3Z35eVldXOX1pairKyMlRWVqKyshJVVVW1U2VlJTw8PODl5XXe5O3tjaCgICQnJzcoL4uaiByipKQEe/bswb59+3Dw4EEcOHDgvK+HDx/GiRMn6nwfb29vBAQEwM/PD15eXvDw8ICnpyc8PDxqJ1VFRUVF7VRZWYmKiorzCtdezv3ccz+7srLyvPlCQ0Nx+PDhBn3GpYqaJ1QSkd0EBgYiMjISkZGRF52noqICxcXF+Omnn1BUVISioiIUFxfj9OnTF5wqKipqR7IXGtV6enr+bmTr6+sLX19fNGnS5Lzv/fz84OfnB19f39qvZycfHx80adKkdvLx8YGXlxdE5KL3VlFVVFZWory8/ILFbS8saiJyKC8vL4SEhCAkJMTsKI0mIrV/QRiJ15YSEVkci5qIyOJY1EREFseiJiKyOJuKWkSGiUiBiOwWkaeMDkVERL+qs6hFxBPAVAAxALoBGCci3YwORkRE1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QCiKr5fceajfYtgPyzy1p4PUJRPTo4CeB4zffBF1vW2dbDCbdHKoBiADk1U9allnW29XDC7fGXmpw5ANIB3GDF7XF24iXkREQW5277qImInA6LmojI4ljUREQWx6ImIrI4FjURkcWxqImILI5FTURkcf8PsCrwhDSYA58AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "def get_kde(x,data_array,bandwidth=0.1):\n",
    "    def gauss(x):\n",
    "        import math\n",
    "        return (1/math.sqrt(2*math.pi))*math.exp(-0.5*(x**2))\n",
    "    N=len(data_array)\n",
    "    res=0\n",
    "    if len(data_array)==0:\n",
    "        return 0\n",
    "    for i in range(len(data_array)):\n",
    "        res += gauss((x-data_array[i])/bandwidth)\n",
    "    res /= (N*bandwidth)\n",
    "    return res\n",
    "import numpy as np\n",
    "input_array=[0.147,0.072,0.048,0.028,0.041,0.065,0.025,0.047,0.179,0.231,0.165,0.037,0.063,0.026,0.13,0.051,0.043,0.044,0.321,0.024,0.022,0.031,0.043,0.016,0.025,0.057,0.027,0.018,0.046,0.018,0.03]\n",
    "bandwidth=1.05*np.std(input_array)*(len(input_array)**(-1/5))\n",
    "x_array=np.linspace(min(input_array),max(input_array),50)\n",
    "y_array=[get_kde(x_array[i],input_array,bandwidth) for i in range(x_array.shape[0])]\n",
    "print(x_array)\n",
    "print(\"-\"*30)\n",
    "print(y_array)\n",
    "import matplotlib.pyplot as plt\n",
    "plt.figure(1)\n",
    "\n",
    "plt.plot(x_array.tolist(),y_array,color='black',linestyle='-')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
